\(\int (c+d x) \tan (a+b x) \, dx\) [212]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 12, antiderivative size = 66 \[ \int (c+d x) \tan (a+b x) \, dx=\frac {i (c+d x)^2}{2 d}-\frac {(c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{b}+\frac {i d \operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{2 b^2} \]

[Out]

1/2*I*(d*x+c)^2/d-(d*x+c)*ln(1+exp(2*I*(b*x+a)))/b+1/2*I*d*polylog(2,-exp(2*I*(b*x+a)))/b^2

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3800, 2221, 2317, 2438} \[ \int (c+d x) \tan (a+b x) \, dx=\frac {i d \operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{2 b^2}-\frac {(c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{b}+\frac {i (c+d x)^2}{2 d} \]

[In]

Int[(c + d*x)*Tan[a + b*x],x]

[Out]

((I/2)*(c + d*x)^2)/d - ((c + d*x)*Log[1 + E^((2*I)*(a + b*x))])/b + ((I/2)*d*PolyLog[2, -E^((2*I)*(a + b*x))]
)/b^2

Rule 2221

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x]
 - Dist[d*(m/(b*f*g*n*Log[F])), Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2317

Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Dist[1/(d*e*n*Log[F]), Subst[Int
[Log[a + b*x]/x, x], x, (F^(e*(c + d*x)))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 3800

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[I*((c + d*x)^(m + 1)/(d*(m + 1))), x
] - Dist[2*I, Int[(c + d*x)^m*(E^(2*I*(e + f*x))/(1 + E^(2*I*(e + f*x)))), x], x] /; FreeQ[{c, d, e, f}, x] &&
 IGtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {i (c+d x)^2}{2 d}-2 i \int \frac {e^{2 i (a+b x)} (c+d x)}{1+e^{2 i (a+b x)}} \, dx \\ & = \frac {i (c+d x)^2}{2 d}-\frac {(c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{b}+\frac {d \int \log \left (1+e^{2 i (a+b x)}\right ) \, dx}{b} \\ & = \frac {i (c+d x)^2}{2 d}-\frac {(c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{b}-\frac {(i d) \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i (a+b x)}\right )}{2 b^2} \\ & = \frac {i (c+d x)^2}{2 d}-\frac {(c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{b}+\frac {i d \operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{2 b^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.18 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.06 \[ \int (c+d x) \tan (a+b x) \, dx=\frac {1}{2} i d x^2-\frac {d x \log \left (1+e^{2 i (a+b x)}\right )}{b}-\frac {c \log (\cos (a+b x))}{b}+\frac {i d \operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{2 b^2} \]

[In]

Integrate[(c + d*x)*Tan[a + b*x],x]

[Out]

(I/2)*d*x^2 - (d*x*Log[1 + E^((2*I)*(a + b*x))])/b - (c*Log[Cos[a + b*x]])/b + ((I/2)*d*PolyLog[2, -E^((2*I)*(
a + b*x))])/b^2

Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 122 vs. \(2 (56 ) = 112\).

Time = 1.03 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.86

method result size
risch \(\frac {i d \,x^{2}}{2}-i c x -\frac {c \ln \left ({\mathrm e}^{2 i \left (x b +a \right )}+1\right )}{b}+\frac {2 c \ln \left ({\mathrm e}^{i \left (x b +a \right )}\right )}{b}+\frac {2 i d x a}{b}+\frac {i d \,a^{2}}{b^{2}}-\frac {d \ln \left ({\mathrm e}^{2 i \left (x b +a \right )}+1\right ) x}{b}+\frac {i d \operatorname {polylog}\left (2, -{\mathrm e}^{2 i \left (x b +a \right )}\right )}{2 b^{2}}-\frac {2 d a \ln \left ({\mathrm e}^{i \left (x b +a \right )}\right )}{b^{2}}\) \(123\)

[In]

int((d*x+c)*sec(b*x+a)*sin(b*x+a),x,method=_RETURNVERBOSE)

[Out]

1/2*I*d*x^2-I*c*x-1/b*c*ln(exp(2*I*(b*x+a))+1)+2/b*c*ln(exp(I*(b*x+a)))+2*I/b*d*x*a+I/b^2*d*a^2-1/b*d*ln(exp(2
*I*(b*x+a))+1)*x+1/2*I*d*polylog(2,-exp(2*I*(b*x+a)))/b^2-2/b^2*d*a*ln(exp(I*(b*x+a)))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 310 vs. \(2 (53) = 106\).

Time = 0.26 (sec) , antiderivative size = 310, normalized size of antiderivative = 4.70 \[ \int (c+d x) \tan (a+b x) \, dx=\frac {-i \, d {\rm Li}_2\left (i \, \cos \left (b x + a\right ) + \sin \left (b x + a\right )\right ) + i \, d {\rm Li}_2\left (i \, \cos \left (b x + a\right ) - \sin \left (b x + a\right )\right ) + i \, d {\rm Li}_2\left (-i \, \cos \left (b x + a\right ) + \sin \left (b x + a\right )\right ) - i \, d {\rm Li}_2\left (-i \, \cos \left (b x + a\right ) - \sin \left (b x + a\right )\right ) - {\left (b c - a d\right )} \log \left (\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + i\right ) - {\left (b c - a d\right )} \log \left (\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + i\right ) - {\left (b d x + a d\right )} \log \left (i \, \cos \left (b x + a\right ) + \sin \left (b x + a\right ) + 1\right ) - {\left (b d x + a d\right )} \log \left (i \, \cos \left (b x + a\right ) - \sin \left (b x + a\right ) + 1\right ) - {\left (b d x + a d\right )} \log \left (-i \, \cos \left (b x + a\right ) + \sin \left (b x + a\right ) + 1\right ) - {\left (b d x + a d\right )} \log \left (-i \, \cos \left (b x + a\right ) - \sin \left (b x + a\right ) + 1\right ) - {\left (b c - a d\right )} \log \left (-\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + i\right ) - {\left (b c - a d\right )} \log \left (-\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + i\right )}{2 \, b^{2}} \]

[In]

integrate((d*x+c)*sec(b*x+a)*sin(b*x+a),x, algorithm="fricas")

[Out]

1/2*(-I*d*dilog(I*cos(b*x + a) + sin(b*x + a)) + I*d*dilog(I*cos(b*x + a) - sin(b*x + a)) + I*d*dilog(-I*cos(b
*x + a) + sin(b*x + a)) - I*d*dilog(-I*cos(b*x + a) - sin(b*x + a)) - (b*c - a*d)*log(cos(b*x + a) + I*sin(b*x
 + a) + I) - (b*c - a*d)*log(cos(b*x + a) - I*sin(b*x + a) + I) - (b*d*x + a*d)*log(I*cos(b*x + a) + sin(b*x +
 a) + 1) - (b*d*x + a*d)*log(I*cos(b*x + a) - sin(b*x + a) + 1) - (b*d*x + a*d)*log(-I*cos(b*x + a) + sin(b*x
+ a) + 1) - (b*d*x + a*d)*log(-I*cos(b*x + a) - sin(b*x + a) + 1) - (b*c - a*d)*log(-cos(b*x + a) + I*sin(b*x
+ a) + I) - (b*c - a*d)*log(-cos(b*x + a) - I*sin(b*x + a) + I))/b^2

Sympy [F]

\[ \int (c+d x) \tan (a+b x) \, dx=\int \left (c + d x\right ) \sin {\left (a + b x \right )} \sec {\left (a + b x \right )}\, dx \]

[In]

integrate((d*x+c)*sec(b*x+a)*sin(b*x+a),x)

[Out]

Integral((c + d*x)*sin(a + b*x)*sec(a + b*x), x)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 115 vs. \(2 (53) = 106\).

Time = 0.37 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.74 \[ \int (c+d x) \tan (a+b x) \, dx=-\frac {-i \, b^{2} d x^{2} - 2 i \, b^{2} c x - 2 \, {\left (-i \, b d x - i \, b c\right )} \arctan \left (\sin \left (2 \, b x + 2 \, a\right ), \cos \left (2 \, b x + 2 \, a\right ) + 1\right ) - i \, d {\rm Li}_2\left (-e^{\left (2 i \, b x + 2 i \, a\right )}\right ) + {\left (b d x + b c\right )} \log \left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} + 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )}{2 \, b^{2}} \]

[In]

integrate((d*x+c)*sec(b*x+a)*sin(b*x+a),x, algorithm="maxima")

[Out]

-1/2*(-I*b^2*d*x^2 - 2*I*b^2*c*x - 2*(-I*b*d*x - I*b*c)*arctan2(sin(2*b*x + 2*a), cos(2*b*x + 2*a) + 1) - I*d*
dilog(-e^(2*I*b*x + 2*I*a)) + (b*d*x + b*c)*log(cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 + 2*cos(2*b*x + 2*a) +
 1))/b^2

Giac [F]

\[ \int (c+d x) \tan (a+b x) \, dx=\int { {\left (d x + c\right )} \sec \left (b x + a\right ) \sin \left (b x + a\right ) \,d x } \]

[In]

integrate((d*x+c)*sec(b*x+a)*sin(b*x+a),x, algorithm="giac")

[Out]

integrate((d*x + c)*sec(b*x + a)*sin(b*x + a), x)

Mupad [B] (verification not implemented)

Time = 25.46 (sec) , antiderivative size = 148, normalized size of antiderivative = 2.24 \[ \int (c+d x) \tan (a+b x) \, dx=\frac {c\,\ln \left ({\mathrm {tan}\left (a+b\,x\right )}^2+1\right )}{2\,b}-\frac {d\,\left (\pi \,\ln \left (\cos \left (b\,x\right )\right )+\mathrm {polylog}\left (2,-{\mathrm {e}}^{-a\,2{}\mathrm {i}}\,{\mathrm {e}}^{-b\,x\,2{}\mathrm {i}}\right )\,1{}\mathrm {i}-\pi \,\ln \left ({\mathrm {e}}^{-a\,2{}\mathrm {i}}\,{\mathrm {e}}^{-b\,x\,2{}\mathrm {i}}+1\right )+2\,a\,\ln \left ({\mathrm {e}}^{-a\,2{}\mathrm {i}}\,{\mathrm {e}}^{-b\,x\,2{}\mathrm {i}}+1\right )-\pi \,\ln \left ({\mathrm {e}}^{b\,x\,2{}\mathrm {i}}+1\right )+b^2\,x^2\,1{}\mathrm {i}-\ln \left (\cos \left (a+b\,x\right )\right )\,\left (2\,a-\pi \right )+2\,b\,x\,\ln \left ({\mathrm {e}}^{-a\,2{}\mathrm {i}}\,{\mathrm {e}}^{-b\,x\,2{}\mathrm {i}}+1\right )+a\,b\,x\,2{}\mathrm {i}\right )}{2\,b^2} \]

[In]

int((sin(a + b*x)*(c + d*x))/cos(a + b*x),x)

[Out]

(c*log(tan(a + b*x)^2 + 1))/(2*b) - (d*(polylog(2, -exp(-a*2i)*exp(-b*x*2i))*1i - pi*log(exp(b*x*2i) + 1) - pi
*log(exp(-a*2i)*exp(-b*x*2i) + 1) + 2*a*log(exp(-a*2i)*exp(-b*x*2i) + 1) + pi*log(cos(b*x)) + b^2*x^2*1i - log
(cos(a + b*x))*(2*a - pi) + 2*b*x*log(exp(-a*2i)*exp(-b*x*2i) + 1) + a*b*x*2i))/(2*b^2)